home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / pgm_tool / lu62 / rtsend.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  3KB  |  146 lines

  1. /*
  2.                              RTSEND
  3.  
  4.  Function: Request for send operation.
  5.  
  6.  CopyRight 1995. Nicholas Poljakov all rights reserved.
  7. */
  8.  
  9.  
  10. #include <stdio.h>
  11. #include <rtsend.h>
  12. #include <state1.h>
  13. #include <rcb.h>
  14. #include <tcb.h>
  15. #include <lucb.h>
  16. #include <psp.h>
  17. #include <cma.h>
  18. #include <string.h>
  19. int sk_r_wt(void *);
  20. int SendBlock(void *, void *);
  21. int setrc(void *, void *);
  22. int sendhsf(void *);
  23. int sendhs(void *);
  24. int sendbm(void *, void *);
  25. int sendat(void *);
  26. unsigned long rmfmh5(void *, void *);
  27. int recwait(void *);
  28. int rcvru(void *, void *);
  29. int rcvhs(void *, void *, void *, void *);
  30. int ralloc(void *, void *);
  31. int psrm(int, void *, void *);
  32. int ps_conv(int, void *);
  33. int proterr(void *, unsigned long);
  34. int preptrcv(void *, void *);
  35. int post_rcb(void *);
  36. struct repass *postopen(void *);
  37. int phsrec(void *);
  38. int pfmh5(void *);
  39. int opndst(void *);
  40. int obtsess(void *, unsigned char);
  41. int Lrf_handler(void *);
  42. int get_sess(void *, void *);
  43. int get_attr(void *);
  44. int fsm_error(unsigned char, void *);
  45. int fsm_conv(unsigned char, unsigned char, void *);
  46. int flush (void *);
  47. int dcp(void *);
  48. int dealloc(void *);
  49. int crtp(void *);
  50. int conv(void *);
  51. int chkparm(void *, void *);
  52. int check_end(unsigned int, void *);
  53. struct rqb *call_appl(void *);
  54. int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
  55. unsigned long attltck(void *);
  56. unsigned long attacheck(void *);
  57. char *cgetmem(int, int);
  58. int sendhsf(void *);
  59. int opndst(void *);
  60. int alloc_rcb(void *, void *);
  61. int allocate(void *);
  62. int clsdst(void *);
  63.  
  64. rtsend(pptr)
  65. struct rtsend *pptr;
  66.   {
  67. struct rcb *p_rcb;
  68. struct tcb *p_tcb;
  69. struct cma ar;
  70. unsigned int type;
  71. char *p;
  72.  
  73. int  fsm_conv();
  74. int  fsm_error();
  75. unsigned int *m;
  76. char s;
  77. char r;
  78. int code;
  79. int state;
  80.  
  81. #if OS_TYPE == 1
  82. /*********  Trace facility **********/
  83. unsigned int rtype;   /* type of record */
  84. unsigned int pnum;    /* point number */
  85. char pname[8];        /* name of module */
  86. char *drec;       /* record for dump */
  87. int  lenr;            /* record length */
  88.  
  89. rtype = INPROC;
  90. strcpy(pname, "rtsend");
  91. pnum = 1;
  92. drec = pptr;
  93. lenr = sizeof(struct rtsend);
  94. gtf(rtype, pname, pnum, drec, lenr);
  95. /***********************************/
  96. #endif
  97.  
  98.      pptr -> prim_rc = OK;
  99.      s = 'S';
  100.      r = 'R';
  101.  
  102.      if (chkparm(pptr, &ar) == -1) {
  103.         return(0);
  104.      }
  105.      p_rcb = ar.p_rcb;
  106.      p_tcb = ar.p_tcb;
  107.  
  108.      /* Check if the RCB is into wait queue */
  109.      if (sk_r_wt(p_rcb) == 0) {
  110.         pptr -> prim_rc = INCOMPLETE;
  111.         return (0);
  112.      }
  113.  
  114.     /*   place the verb code into the RCB  */
  115.     p_rcb ->verb_code = Request_to_send;
  116.     p_rcb -> verb_ptr = pptr;
  117.  
  118.     if((state = fsm_conv(s,Request_to_send,p_rcb))== -1)
  119.     {
  120.         pptr -> prim_rc = PORT_ABENDED;
  121.         return(0);
  122.     }
  123.     if(state == 1)
  124.     {
  125.         pptr -> prim_rc = PORT_ABENDED;
  126.         return(0);
  127.     }
  128.      else
  129.            {
  130.                if (cdind(p_rcb) == 0) {
  131.                 /* CD not found in the input queue */
  132.                     p = &((*p_rcb).first_out);
  133.                     type = Request_to_send;
  134.                     buffmng('A', NULL, p, p_rcb, 0, 0, type);
  135.                     sendhs(p_rcb);
  136.                }
  137.            }
  138.  end:
  139.  return(0);
  140. }
  141. cdind(p_rcb)
  142. struct rcb *p_rcb;
  143. {
  144.     /* Search for CD indicator in the input queue  */
  145. }
  146.